#include "Camera.h"
#include "Constants.h"
#include <SDL/SDL.h>

Camera::Camera()
{
	xPos = INIT_X_POS;
	yPos = INIT_Y_POS;
	zPos = INIT_Z_POS;
	pitch = INIT_PITCH;
	left = false;
	right = false;
	up = false;
	down = false;
	dive = false;
	pull = false;
}

Camera::~Camera()
{
}

void Camera::handleEvent(bool keys[321])
{
	in = keys[SDLK_w];
	out = keys[SDLK_s];
	
	right = keys[SDLK_d];
	left = keys[SDLK_a];
	
	up = keys[SDLK_c];
	down = keys[SDLK_e];
	
	dive = keys[SDLK_q];
	pull = keys[SDLK_z];
}

void Camera::animate(float timeD)
{
	if(left)
		xPos += MOVE_SPEED * timeD;
	if(right)
		xPos -= MOVE_SPEED * timeD;
	if(in)
		zPos += MOVE_SPEED * timeD;
	if(out)
		zPos -= MOVE_SPEED * timeD;
	if(up)
		yPos += MOVE_SPEED * timeD;
	if(down)
		yPos -= MOVE_SPEED * timeD;
	if(dive)
		pitch += MOVE_SPEED * timeD;
	if(pull)
		pitch -= MOVE_SPEED * timeD;
}
